import os
from asyncio import sleep
from telnetlib import EC

from appium.webdriver import webdriver
from selenium.webdriver.support.wait import WebDriverWait


class Base():
    def __init__(self):
        cap = {
            "platformName": "Android",
            "deviceName": "emulator-5554 ",
            "appPackage": "com.xiachufang",
            "appActivity": "com.xiachufang.activity.home.HomeActivity",
            "noReset": True
        }
        os.system('adb root')
        self.driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub',cap)
        self.driver.implicitly_wait(25)
        sleep(10)

    def loc_wait_ele(self,loc,key):
        ele = self.find_ele(loc)
        return ele.get_attribute(key)

